// JavaScript Document

//IE6 hover--------------

//圆角效果js--------------
$(function(){ 
	$('.box-round').corner('round 5px').parent().css('padding', '1px').corner('round 5px');
});
$(function(){ 
	$('.advanced_in').corner('round bottom 8px').parent().css('padding', '0 2px 2px 2px').corner('round bottom 10px');
});
//$(function(){ 
//	$('.search_li').corner('round 8px').parent().css('padding', '2px').corner('round 10px');
//});

//图片效果js--------------

/*function changeImageSize()
{
   var  imgs = document.getElementById("advanced_in").getElementsByTagName("img");
   var count = 0;
   for(var i=0;i<imgs.length;i++)
   {
	   image = imgs[i];
	   alert(image.width+"---"+image.height);
	   if(image.width>78 || image.heigh>63){
	   	  if(image.width > image.height){
			  image.width=78;
			  image.height=auto;
		  } else if(image.width == image.height){
			  image.width=78;
			  image.height=63;
		  } else if(image.width < image.height){
			  image.height=63;
			  image.width=auto;
		  } 
	   }
	   count++;
	   alert(count);
   }
}*/
/*
$(function(){
		var x = 10;
		var y = 10;
		$('a.tooltip').mouseover(function(e){
			this.myTitle = this.title;
			this.title = "";
			var tooltip = "<div id='tooltip'>" + this.myTitle + "<\/div>";	
			$('body').append(tooltip);
			$('#tooltip').css({
				top:(e.pageY + y) + "px",
				left:(e.pageX + x) + "px"
			}).show('slow');
		}).mouseout(function(){
			this.title = this.myTitle;
			$('#tooltip').remove();
		}).mousemove(function(e){
			$('#tooltip').css({
				top:(e.pageY + y) + "px",
				left:(e.pageX + x) + "px"
			});
		});	
		
		$('.photo li>a').mouseover(function(e){
			this.myTitle = this.title;
			this.title = "";
			var imgTitle = this.myTitle? "<span>" + this.myTitle + "</span>" : "";
 
			var tooltip = "<div id='tooltip'><img src='"+ this.href +"' alt=''/>"+ imgTitle +"<\/div>";
			$('body').append(tooltip);
			$('#tooltip').css({
				top:(e.pageY + y) + "px",
				left:(e.pageX + x) + "px",
				opacity:"1"
			}).show('fast');
		}).mouseout(function(){
			this.title = this.myTitle;
			$('#tooltip').remove();
		}).mousemove(function(e){
			$('#tooltip').css({
				top:(e.pageY + y) + "px",
				left:(e.pageX + x) + "px",
				opacity:"1"
			});
		});	
});	
*/
//产品分类js-------------------

/*window.onload = function(){
	$("#selectSub ul li").click(function(){
   $("#address").attr("value",$(this).text());
   });
}*/
jQuery.fn.selectCity = function(targetId) {
	var _seft = this;
	var targetId = $(targetId);

	this.click(function(){
		/*var A_top = $(this).offset().top + $(this).outerHeight(true);  //  1
		var A_left =  $(this).offset().left;*/
		targetId.bgiframe();
		targetId.slideDown('fast').css({"position":"absolute","top":65 + "px" ,"left":372 + "px"});
	});

	targetId.find("#selectItemClose").click(function(){
		targetId.slideUp('fast');
	});


	
	$("#selectSub ul li").click(function(){
    	$("#category").attr("value",$(this).text());
    });
	
	$(document).click(function(event){
		if(event.target.id!=_seft.selector.substring(1)){
			targetId.slideUp('fast');	
		}
	});

    return this;
}
 
$(function(){
	$("#category").selectCity("#selectItem");
});
